package com.test.flink_source;

import com.google.common.collect.Lists;
import com.test.beans.UserBean;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.util.NumberSequenceIterator;

import java.util.List;

public class F03ParallelCollection {

    public static void main(String[] args) throws Exception {
        Configuration configuration = new Configuration();
        configuration.setInteger("rest.port", 8888);
        StreamExecutionEnvironment webUI = StreamExecutionEnvironment.createLocalEnvironmentWithWebUI(configuration);

        DataStreamSource<Long> data = webUI.fromParallelCollection(new NumberSequenceIterator(1, 10), Long.class);

        System.out.println(data.getParallelism());
        data.setParallelism(2);

        data.print();
        webUI.execute();
    }
}
